<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="black" name="apple-mobile-web-app-status-bar-style">
	<title>订单详情</title>
    <script src="/Public/Home/js/zepto.min.js"></script>
    <link href="/Public/Home/css/weui.min.css" rel="stylesheet">
	<link rel="stylesheet" href="/Public/Home/SaleManager/stylesheets/index.css">
</head>
<body>
	<div class="orderInfo">
		<header class = "all_header">
			<a class = "h_back h_back_1" data-back='1' href="javascript:void(0)"><img src="/Public/Home/SaleManager/images/back_icon.png" alt=""></a>
			<span class = "h_title">订单详情</span>
			<a class = "h_add" href="javascript:void(0)"></a>
		</header>
		<div class="order">
			<div class="order_adress">
				<a class = "adress_icon" href="javascript:void(0)"><img src="/Public/Home/SaleManager/images/order_adress.png" alt=""></a>
				<span><?php echo ($address); ?></span>
			</div>
			<?php if(is_array($info)): $i = 0; $__LIST__ = $info;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><div class="order_list">
				<div class="order_name_w">
					<span class = "order_name"><?php echo ($v["drugs_name"]); ?></span>
					<!-- <span class = "order_del">删除</span> -->
				</div>
				<div class="order_price_w">
					<span class = "order_w">单价</span>
					<span>¥<?php echo ($v["price"]); ?></span>
				</div>
				<div class="order_count">X<?php echo ($v["num"]); ?></div>
				<div class="all_price_w">
					<span class = "order_w">总价</span>
					<span>¥<span class = "all_num"><?php echo ($v["total_price"]); ?></span></span>
				</div>
			</div><?php endforeach; endif; else: echo "" ;endif; ?>
			<div class="total_price_w">
				<span class = "total_name">商品总额：</span>
				<span><span class = "total_num">¥<?php echo ($total); ?></span></span>
			</div>
		</div>
		<input type='hidden' name='oid' id='oid' value=<?php echo ($oid); ?>>
		<input type='hidden' name='status' id='status' value=<?php echo ($status); ?>>
		<?php if($status != '已完成'): ?><div class="weui-btn-area">
     			 <a class="weui-btn total_btn" href="javascript:">完成</a>
    			</div><?php endif; ?>
		<div class="js_dialog" id="confirm_dialog" style="display: none;">
      <div class="weui-mask"></div>
      <div class="weui-dialog">
        <div class="weui-dialog__bd"></div>
        <div class="weui-dialog__ft">
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary">确 定</a>
        </div>
      </div>
    </div>
    <div class="js_dialog" id="iosDialog1" style="display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__hd"><strong class="weui-dialog__title">提示</strong></div>
        <div class="weui-dialog__bd confir_content"></div>
        <div class="weui-dialog__ft">
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default cancel-btn">取消</a>
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary ok-btn">确定</a>
        </div>
    </div>
</div>
 <div class="js_dialog" id="jsconfiroms" style="display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__hd"><strong class="weui-dialog__title">提示</strong></div>
        <div class="weui-dialog__bd confir_content"></div>
        <div class="weui-dialog__ft">
            
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary oksss-btn">确定</a>
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default cancelsss-btn">取消</a>
        </div>
    </div>
</div>


  <script type="text/javascript">
	var saleManagerStatus; //操作返回状态
	$(document).ready(function() { 
		saleManagerStatus='';
		saleManagerStatus ='<?php echo ($status); ?>';  //success,成功；error,错误
		msg ='<?php echo ($msg); ?>';
		if(saleManagerStatus=='success'||saleManagerStatus=='validatefail'){
			$('.weui-dialog__bd').html(msg);
     		$('#confirm_dialog').css('display','block');
     		//saleManagerStatus='formSubmitTrue';
		}
		if(saleManagerStatus=='error'){ 
			$('.weui-dialog__bd').html(msg);
     		$('#confirm_dialog').css('display','block');
     		//saleManagerStatus='formSubmitTrue';
		}
	}); 
	//关闭弹出框
	$(document).on('click','.weui-dialog__btn_primary',function(){
		$('#confirm_dialog').css('display','none');
		if(saleManagerStatus=='error'){
			history.go(-1);
		}
	}); 
	
	$(document).on('click','.cancelsss-btn',function(){
		$('#jsconfiroms').css('display','none');
	});
  </script>
	</div>
	<script src = "/Public/Home/SaleManager/js/index.js"></script>
	<script src = "/Public/Home/SaleManager/js/Common.js"></script>
	<script src = "/Public/Home/SaleManager/js/androidback.js"></script>
</body>
<script>
var sessionStatus;
var sessionUrl;
var oid;
$(document).on('click','.total_btn',function(){
	$id = $(this).attr('data-clinicid');
	oid ='<?php echo ($oid); ?>';
	//删除事件
		$.ajax({
            url: "/Home/SaleManager/County/completOrder",
            type: 'POST',
            data: {'oid':oid},
            async: false,
            cache: false,
           dataType:"json",
            success: function (returndata) {
            		sessionStatus=returndata.code;
            		sessionUrl=returndata.data;
          		　$('.weui-dialog__bd').html(returndata.msg);
           		  $('#confirm_dialog').css('display','block');
            },
            error: function (returndata) {
            	　	$('.weui-dialog__bd').html("操作失败");
          		 $('#confirm_dialog').css('display','block');
            }
        });
	})
	$(document).on('click','.weui-dialog__btn_primary',function(){
		if(sessionStatus==2028){
			window.location.href=sessionUrl;
		}else{
			window.location.href='/Home/SaleManager/County/orderlist';
		}
			
	})
</script>
</html>